package ren.kane.asdppp.transaction.change.affiliation;

import ren.kane.asdppp.PayrollDatabase;
import ren.kane.asdppp.affiliation.Affiliation;
import ren.kane.asdppp.affiliation.NoAffiliation;
import ren.kane.asdppp.affiliation.UnionAffiliation;
import ren.kane.asdppp.Employee;

/**
 * @author renrk(1275) on 2019-04-20 10:18 PM
 **/
public class ChangeUnaffiliatedTransaction extends ChangeAffiliationTransaction {

    public ChangeUnaffiliatedTransaction() {
    }

    public ChangeUnaffiliatedTransaction(int empId) {
        super(empId);
    }

    @Override
    protected Affiliation getAffiliation() {
        return new NoAffiliation();
    }

    @Override
    protected void recordMemberShip(Employee employee) {
        Affiliation affiliation = employee.getAffiliation();
        UnionAffiliation unionAffiliation = (UnionAffiliation) affiliation;
        int memberId = unionAffiliation.getMemberId();
        PayrollDatabase.removeUnionMember(memberId);
    }
}
